from event_bus import EventBus
from uis import BlankMessage
from wxutils import call_after


class BareMessage(BlankMessage):

    def __init__(self, parent, prompt, title):
        super().__init__(parent)

        self.prompt_text.SetLabel(prompt)
        self.SetTitle(title)

        EventBus().register_topic(topic="toggle_upgrade_sources", handler=self.dismiss_self)
        EventBus().register_topic(topic="toggle_upgrade_samples", handler=self.dismiss_self)

    @call_after
    def dismiss_self(self, event):
        if not event:
            self.EndModal(-1)
